package com.ap.core.validation.message.rules;

import com.ap.core.dao.ZappConsumerUserDao;
import com.ap.core.domain.ZappConsumerUser;
import com.ap.core.message.managepayment.info.RetrieveRTPMessageInfo;
import com.ap.core.validation.message.info.MessageValidationInfo;
import com.ap.core.validation.message.info.RTPOriginalInfo;
import com.ap.core.validation.rules.AbstractValidationRule;

/**
 * User: Ranjit.Singh
 * Check if provided Bank Consumer ID is not registered.
 */
public class RV0007Rule extends AbstractValidationRule<MessageValidationInfo<RetrieveRTPMessageInfo, RTPOriginalInfo>> {

    	
	private ZappConsumerUserDao zappConsumerUserDao;

     
    @Override
    public boolean validate(MessageValidationInfo<RetrieveRTPMessageInfo, RTPOriginalInfo> infoObject) {
    	ZappConsumerUser zappConsumerUser = zappConsumerUserDao.getZappConsumerUserByFiIdentificationAndFiCustomerId(infoObject.getBoundObject().getRequestInfo().getFIId(),
    				                                                                                        infoObject.getBoundObject().getRequestInfo().getFIConsumerId());
    	return null != zappConsumerUser;
    }

    public void setZappConsumerUserDao(ZappConsumerUserDao zappConsumerUserDao) {
        this.zappConsumerUserDao = zappConsumerUserDao;
    }
}
